while True:
    try:
        number1 = float(input("请输入第一个数字: "))
        operator = input("请输入(+, -, *, /): ")
        number2 = float(input("请输入第二个数字: "))

        if operator == "+":
            result = number1 + number2
        elif operator == "-":
            result = number1 - number2
        elif operator == "*":
            result = number1 * number2
        elif operator == "/":
            if number2 != 0:
                result = number1 / number2
            else:
                print("错误：除数不能为零")
                continue
        else:
            print("错误：无效的操作符")
            continue

        print("等于:", result)

        repeat = input("是否继续计算(y/n)？: ")
        if repeat.lower() != "y":
            break

    except ValueError:
        print("错误：请输入有效的数字")
    except Exception as e:
        print("发生错误:", e)
